home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / utmisc2 / iffmst16.lha / IFFMaster / rexx / ImportTERMpbook.rexx < prev    next >
OS/2 REXX Batch file  |  1996-05-04  |  2KB  |  87 lines

  1. /*
  2. **  $VER: ImportTermPB-DFA.rexx 0.001 (12 Feb 1996)  **
  3. **
  4. **        © 1996 Andreas Mixich
  5. **        original Arexx script by Kay Drangmeister
  6. **
  7. **
  8. **  PROGRAMNAME:
  9. **      ImportTermPB-DFA.rexx
  10. **
  11. **  FUNCTION:
  12. **      Reads out the number, name and comment of all TERM phonebook entry and
  13. **      add them to DFA.
  14. **
  15. **  $HISTORY:
  16. **
  17. **   12 Feb 1996 : 0.01 : initial release
  18. */
  19.  
  20.  
  21. SIGNAL ON SYNTAX
  22. SIGNAL ON ERROR
  23.  
  24. OPTIONS RESULTS
  25.  
  26. PortName = 'IFFMASTER.1'
  27. LF = '0a'x
  28. TAB = '09'x
  29.  
  30. ADDRESS VALUE PortName
  31.  
  32. IFFMACTIVE=1
  33. IF ~SHOW('Ports',PortName) THEN DO
  34.     IFFMACTIVE=0
  35.     ADDRESS 'COMMAND' 'Run >NIL: GFX:Tools/IFFMaster'
  36.     ADDRESS 'COMMAND' 'WaitForPort '||PortName
  37.     IF ~SHOW('Ports',PortName) THEN EXIT 10
  38. END
  39.  
  40.  
  41. 'load term:config/phonebook.prefs'
  42. 'entries'
  43. nument=RESULT
  44. 'limithex bytes 16'     /* we ignore hex dumps */
  45.  
  46. count=0
  47. DO i=0 FOR nument;
  48.     'cursorpos 'i
  49.     'chunkid'
  50.     ID=RESULT
  51.     IF ID='PHON' THEN DO
  52.         count=count+1
  53.         'chunkstruct sepstring "|"'
  54.         phon=RESULT
  55.         PARSE VAR phon . '|' name '0a'x . '|' phone '0a'x . '|' comment '0a'x .
  56.         name.count=strip(name,'B','"')
  57.         phone.count=strip(phone,'B','"')
  58.         comment.count = strip(comment,'B','"')
  59.     END
  60. END
  61.  
  62. ADDRESS DFA
  63.  
  64. DO i = 1 TO count
  65.     'NEW FIRST "BBS" NAME "'||name.i||'" PHONE "'||phone.i||'" COMMENT "'||comment.i||'"'
  66.     'POPUP'
  67. END
  68.  
  69. IF IFFMACTIVE=0 THEN
  70.     DO
  71.     ADDRESS Value portname
  72.     'quit'     /* we started IFFMaster ourselves, so close it */
  73.     END
  74.  
  75. EXIT(0)
  76.  
  77. /* what to do on an error */
  78. ERROR:
  79. SYNTAX:
  80.  
  81.     SAY '+++ Error' rc 'in line' sigl '-' ERRORTEXT(rc)
  82.     SAY SOURCELINE(sigl)
  83.  
  84. EXIT(rc)
  85.  
  86.  
  87.